<template>
  <div>
    <el-dialog
      v-dialogDrag
      append-to-body
      :close-on-click-modal="false"
      :before-close="crud.cancelCU"
      :visible="crud.status.cu > 0"
      :title="crud.status.title"
      width="500px"
    >
      <el-form
        ref="form"
        :model="form"
        :rules="rules"
        size="small"
        label-width="80px"
      >
        <el-form-item
          label="专业名称"
          prop="majorname"
        >
          <el-input
            v-model="form.majorname"
            style="width: 370px;"
            placeholder="输入专业名称"
          />
        </el-form-item>
        <el-form-item
          label="专业代码"
          prop="majorcode"
        >
          <el-input
            v-model="form.majorcode"
            style="width: 370px;"
            placeholder="输入专业代码"
          />
        </el-form-item>
        <el-form-item
          label="班级名称"
          prop="classname"
        >
          <el-input
            v-model="form.classname"
            :rows="2"
            placeholder="请输入班级名称"
          />
        </el-form-item>
        <el-form-item
          label="人数"
          prop="classnum"
        >
          <el-input-number v-model="form.classnum" :disabled="false" />
        </el-form-item>
      </el-form>
      <div
        slot="footer"
        class="dialog-footer"
      >
        <el-button
          type="text"
          @click="crud.cancelCU"
        >
          取消
        </el-button>
        <el-button
          :loading="crud.status.cu === 2"
          type="primary"
          @click="crud.submitCU"
        >
          确认
        </el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { form } from '@crud/crud'
const defaultGradeForm = {
  id: null,
  classnum: 0
}
export default {
  mixins: [form(defaultGradeForm)],
  props: {
  },
  data() {
    return {
      rules: {
        classname: [
          { required: true, message: '请输入班级名称', trigger: 'blur' }
        ],
        majorname: [
          { required: true, message: '请输入专业名称', trigger: 'blur' }
        ],
        majorcode: [
          { required: true, message: '请输入专业代码', trigger: 'blur' }
        ]
      }
    }
  },
  methods: {

  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
  /deep/ .el-input-number .el-input__inner {
    text-align: left;
  }
</style>
